package com.example.capsule_netty.global;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author zhuzhiming
 * @Date 2022/4/30 20:08
 */
public class GlobalThreadPool {

    private GlobalThreadPool() {
    }

    public static ThreadPoolExecutor buildThreadPool() {
        return ThreadPoolBuilder.doBuildThreadPool();
    }


    private static class ThreadPoolBuilder {

        private static ThreadPoolExecutor POOL = new ThreadPoolExecutor(
                6,
                12,
                3,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<>());


        private static ThreadPoolExecutor doBuildThreadPool() {
            return ThreadPoolBuilder.POOL;
        }
    }


}
